package com.gdufs.secondhandwebsite.dao;

import com.gdufs.secondhandwebsite.entity.Tag;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import java.util.List;


@SpringBootTest
@RunWith(SpringRunner.class)
public class testTagMapper {
//    int CreateTag(Tag tag);
//    List<String> SelectByTagType(String tagType);
    @Autowired
    TagMapper tagMapper;
    @Test
    public void testCreateTag(){
        Tag t= new Tag();
        t.setTagName("求好物");
        t.setTagType("操作");
        tagMapper.CreateTag(t);
        Tag t1= new Tag();
        t1.setTagName("同城交易");
        t1.setTagType("操作");
        tagMapper.CreateTag(t1);
    }
    @Test
    public void testSelectByTagType(){
        List<Tag> list = tagMapper.SelectByTagType("讨论");
        for(Tag a:list){
            System.out.println(a);
        }
    }
    @Test
    public void testGetTagById(){
        Tag tag = tagMapper.getTagByTagId(1);
        System.out.println(tag);
    }
}
